#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableNewFunctionOpenDao:DaoBase<TableNewFunctionOpen>
    {
        public override string GetFileName()
        {
            return "TableNewFunctionOpen.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimary = new Dictionary<string, TableNewFunctionOpen>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableNewFunctionOpen model)
        {
            #if UNITY_EDITOR
            if(cachePrimary.ContainsKey(model.funcName)) UnityEngine.Debug.LogError("数据表id重复:TableNewFunctionOpen->id: " + model.funcName);
            #endif
            cachePrimary[model.funcName] = model;
        }
        protected override TableNewFunctionOpen ParseRowData(string[] rowData)
        {
            TableNewFunctionOpen data = new TableNewFunctionOpen();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.funcName = rowData[0];
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.funcType = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.funcParam = rowData[2];
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.posX = double.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.posY = double.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.townPageExtracted = int.Parse(rowData[5]);
            }
            return data;
        }
    }
}
